package gps.implementationAPI;

import gps.GPSRun;
import gps.api.GPSProblem;
import gps.api.GPSRule;
import gps.api.GPSState;
import gps.rules.Rules;

import java.awt.Point;
import java.util.List;

public abstract class GPSGenericProblemImplementation implements GPSProblem {

	protected GPSState gpsState;
	protected Rules gpsRules;
	
	public GPSGenericProblemImplementation() {
		this.gpsState = new GPSStateImplementation();
		this.gpsRules = new Rules();
	}
	
	public GPSState getInitState() {
		return this.gpsState;
	}

	public GPSState getGoalState() {
		return GPSStateImplementation.getOneGoalState(new Point(GPSRun.N/2, GPSRun.N/2));
	}

	public List<GPSRule> getRules() {
		if (this.gpsRules.getRules().isEmpty()) {
			this.gpsRules.createRules();
		}
		return this.gpsRules.getRules();
	}

}
